#include "mainwindow.h"
#include "listwidget.h"
#include "varietywidget.h"
#include "scanner.h"

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;

    Scanner into;
    QVector<Character> charList;
    into.ScanChar(charList);
    QVector<Word> keyword,singleChar;
    into.ScanWord(keyword,_keyword);
    into.ScanWord(singleChar,_delimiter_single_char);

    ListWidget widgetChar(charList),widgetKeyword(keyword),widgetSingle(singleChar);
    VarietyWidget widgetVariety;

    QObject::connect(&w,&MainWindow::LookChar,&widgetChar,[&widgetChar](){
        widgetChar.show();
    });
    QObject::connect(&w,&MainWindow::LookKeyword,&widgetKeyword,[&widgetKeyword](){
        widgetKeyword.show();
    });
    QObject::connect(&w,&MainWindow::LookSingle,&widgetSingle,[&widgetSingle](){
        widgetSingle.show();
    });
    QObject::connect(&w,&MainWindow::LookVariety,&widgetVariety,[&widgetVariety](){
        widgetVariety.show();
    });

    QObject::connect(&widgetChar,&ListWidget::CloseWidget,&w,&MainWindow::show);
    QObject::connect(&widgetKeyword,&ListWidget::CloseWidget,&w,&MainWindow::show);
    QObject::connect(&widgetSingle,&ListWidget::CloseWidget,&w,&MainWindow::show);
    QObject::connect(&widgetVariety,&VarietyWidget::CloseWidget,&w,&MainWindow::show);

    w.show();
    return a.exec();
}
